home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / nn.zip / GLOBAL.H < prev    next >
C/C++ Source or Header  |  1989-12-31  |  3KB  |  180 lines

  1. /*
  2.  *    Marks for global/external variables
  3.  */
  4.  
  5. #define    export            /* export variable from module */
  6. #define import    extern        /* import variable into module */
  7.  
  8. /*
  9.  *    Various constants and types
  10.  */
  11.  
  12. typedef int32    article_number;
  13. typedef int16    group_number;
  14. typedef uint32    time_stamp;
  15.  
  16. /* frequently used characters */
  17.  
  18. #define NUL    '\0'
  19. #define TAB    '\t'
  20. #define NL    '\n'
  21. #define CR    '\r'
  22. #define BS    '\b'
  23. #define SP    ' '
  24.  
  25. /* misc macros */
  26.  
  27. #define fl fflush(stdout)
  28.  
  29. #ifdef CONTROL_
  30. #undef CONTROL_
  31. #endif
  32. #define CONTROL_(c)    (c&037)
  33.  
  34. #ifndef HAVE_STRCHR
  35. #define    strrchr        rindex
  36. #define strchr        index
  37. #endif
  38.  
  39. #ifdef SIGNAL_HANDLERS_ARE_VOID
  40. typedef void sig_type;
  41. #else
  42. typedef int sig_type;
  43. #endif
  44.  
  45. #ifndef NNTP
  46. #undef NNTP_POST
  47. #endif
  48.  
  49. /*
  50.  *    Some systems don't define these in <sys/stat.h>
  51.  */
  52.  
  53. #ifndef S_IFMT
  54. #define    S_IFMT    0170000            /* type of file */
  55. #define S_IFDIR    0040000            /* directory */
  56. #define S_IFREG    0100000            /* regular */
  57. #endif
  58.  
  59. #ifndef O_RDONLY
  60. #define    O_RDONLY    0
  61. #define    O_WRONLY    1
  62. #define    O_RDWR        2
  63. #endif
  64.  
  65. /* define types of library functions */
  66.  
  67. char     *malloc(), *calloc();
  68. char     *getenv(), *ctime();
  69. char     *strchr(), *strrchr();
  70. off_t     lseek(), ftell(), tell();
  71. time_t     time();
  72. int    atoi();
  73. long    atol();
  74.  
  75.  
  76. /* define types of own functions */
  77.  
  78. char *mk_file_name(), *home_relative();
  79. char *date_time(), *user_name();
  80. char *copy_str();
  81.  
  82. time_t    file_exist(), m_time();
  83.  
  84. extern FILE *open_file();
  85. char *relative();
  86.  
  87. #define    OPEN_READ    0    /* open for reading */
  88. #define    OPEN_UPDATE    1    /* open/create for update */
  89. #define    OPEN_CREATE    2    /* create/truncate for write */
  90. #define    OPEN_APPEND    3    /* open for append */
  91.  
  92. #define    DONT_CREATE    0x40    /* return if file does not exist */
  93. #define    MUST_EXIST    0x80    /* fatal error if cannot open */
  94. #define    OPEN_UNLINK    0x100    /* unlink after open (not OPEN_UPDATE) */
  95.  
  96.  
  97. /*
  98.  *    Other external definitions
  99.  *
  100.  *    NOTICE: the distinction between pointers and arrays is important
  101.  *        here (they are global variables - not function arguments)
  102.  */
  103.  
  104. extern char
  105.  
  106.     *home_directory,
  107.     *nn_directory,
  108.  
  109.     news_directory[],
  110.     lib_directory[],
  111.     db_directory[],
  112.  
  113.     *pager;
  114.  
  115.  
  116. extern int
  117.  
  118.     s_hangup,    /* hangup signal */
  119.     s_keyboard,    /* keyboard signal */
  120.     s_pipe,    /* broken pipe */
  121.     s_redraw,    /* continue signal after stop */
  122.  
  123. #ifdef NNTP
  124.     use_nntp,   /* 1 iff we are using nntp */
  125. #endif
  126.  
  127.     is_master;
  128.  
  129.  
  130. unsigned short            /* as they are on most systems... */
  131.  
  132.     user_id,
  133.     group_id;
  134.  
  135. int
  136.  
  137.     process_id;
  138.  
  139. extern int errno;
  140.  
  141. #include "vararg.h"
  142. #include "data.h"
  143.  
  144. /*
  145.  *    db external data
  146.  */
  147.  
  148. extern master_header master;
  149.  
  150. /* group headers */
  151.  
  152. extern group_header *active_groups, **sorted_groups;
  153.  
  154. /* current group information */
  155.  
  156. extern char     group_path_name[];
  157. extern char    *group_file_name;
  158.  
  159. extern group_header *current_group, *group_sequence;
  160.  
  161. extern group_header *lookup();
  162.  
  163.  
  164. #define    Loop_Groups_Number(num) \
  165.     for (num = master.number_of_groups; --num >= 0; )
  166.  
  167. #define Loop_Groups_Header(gh) \
  168.     for (gh=active_groups+master.number_of_groups; --gh >= active_groups;)
  169.  
  170. int l_g_index;
  171.  
  172. #define Loop_Groups_Sorted(gh) \
  173.     for (l_g_index = 0; \
  174.      (l_g_index < master.number_of_groups) && \
  175.      (gh = sorted_groups[l_g_index]) ;\
  176.      l_g_index++)
  177.  
  178. #define    Loop_Groups_Sequence(gh) \
  179.     for (gh = group_sequence; gh; gh = gh->next_group)
  180.